package org.jgs1904.entity;

import java.util.Date;
import java.util.List;

import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 	帖子实体类
 * @author junki
 * @date 2020年3月26日
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class Post {

	private Long id;
	
	private Long user_id;
	
	@Excel(name = "标题", width = 20)
	private String title;
	
	@Excel(name = "类型", replace = {"Java_0", "游戏_1", "美食_2"})
	private Byte type;
	
	@Excel(name = "摘要", width = 40)
	private String summary;
	
	@Excel(name = "内容", width = 60)
	private String content;
	
	@Excel(name = "发帖时间", format = "yyyy-MM-dd HH:mm:ss", width = 30)
	private Date create_time;
	
	@Excel(name = "主图路径", width = 30)
	private String image;
	
	// 以下字段用于包装数据，不是数据库表字段
	
	@Excel(name = "评论数")
	private Long comment_count;
	
	@Excel(name = "作者")
	private String nickname;
	
	private List<Comment> comment_list;

	// 修改set方法参数，保证excel导入可用
	public void setType(Byte type) {
		this.type = type;
	}
	public void setType(int type) {
		this.type = (byte)type;
	}
	
	public void setComment_count(Long comment_count) {
		this.comment_count = comment_count;
	}
	public void setComment_count(int comment_count) {
		this.comment_count = (long)comment_count;
	}
	
}
